﻿<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width,height=device-height, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0,shrink-to-fit=no" />
<meta name="format-detection" content="telephone=no" />
<!--em标准js代码，请放在页面的最上方，前面最好不要再有JS代码或JS文件-->
<script type="text/javascript" src="/js/rem.js"></script>
<link type="text/css" rel="stylesheet" href="/css/css.css" />
<link type="text/css" rel="stylesheet" href="/css/style.css" />
<title>东易日盛装饰开业盛典</title>
</head>

<body>		

	<div class="header">
		<a href="javascript:history.go(-1);" class="backa"></a>

		<a href="javascript:;" class="seta"></a>
	</div>	

	<div class="main main2">
		<div class="wp1">
			<div class="wp2">
				
				<div class="t1">修改密码</div>

				<div class="m2_fm">
				</div>

				<div class="m2_us">

					<input type="text" class="p3_inp" id="password" name="password" placeholder="输入旧密码" style="margin-top: 30px">
					<input type="text" class="p3_inp" id="newPwd" name="newPwd" placeholder="输入新密码">
					<input type="text" class="p3_inp" id="reNewPwd" name="reNewPwd" placeholder="确认新密码">
					<input type="text" class="p3_inp" id="msg" name="msg" style="border: none;color: red">

					<div class="clear"></div>
				</div>


				<!--<a herf="#" onclick="erweima()" class="go" style="margin-bottom: 3rem;">生成二维码</a>-->
				<a herf="#" onclick="sumbit()" class="go">确认</a>

			</div>
		</div>
	</div>

	<img src="/images/bodysd.jpg" alt="" class="sd">
	<script type="text/javascript" src="/js/jquery-1.11.1.min.js"></script>
	<script type="text/javascript" src="/js/popups.js"></script>
	<script type="text/javascript">
		//提交
		function sumbit() {
			var flag=true;
			$("#msg").val("");
			var password=$("#password").val();
			var newPwd=$("#newPwd").val();
			var reNewPwd=$("#reNewPwd").val();

			//非空验证
			if (!checkPwd(password)){flag=false;}
			if (!checkNewPwd(newPwd)){flag=false;}
			if (!checkReNewPwd(newPwd,reNewPwd)){flag=false;}

			if(flag){
				$.ajax({
					url:"/designer/modifyPwd",
					method:"post",
					data: {
						password:password,
						newPwd:newPwd
					},
					success:function (data) {
						if(data.msg==0){
							$("#msg").val("该用户不存在")
						}
						if(data.msg==2){
							$("#msg").val("旧密码错误")
						}
						if(data.msg==1){
							jqtoast("修改成功");
							setTimeout(function () {
								location.href="/designer/index"
							},2000)
						}
					}
				})
			} else {

			}

		}
		//非空验证
		function checkPwd(password) {
			if(password==""){
				$("#msg").val("请输入旧密码");
				return false;
			} else {
				return true;
			}
		}
		function checkNewPwd(newPwd) {
			if(newPwd==""){
				$("#msg").val("请输入新密码");
				return false;
			} else if (newPwd.length<6){
				$("#msg").val("密码长度不小于6位");
				return false;
			} else {
				return true;
			}
		}
		function checkReNewPwd(newPwd,reNewPwd) {
			if(reNewPwd==""){
				$("#msg").val("请再次输入新密码");
				return false;
			} else if (newPwd!=reNewPwd){
				$("#msg").val("两次输入密码不一致");
				return false;
			} else {
				return true;
			}
		}
	</script>
</body>

<script type="text/javascript" src="/js/base.js"></script>
<script type="text/javascript">
</script>
</html>